class Feed::MoneyConsumedInTaobaoCallBack < Feed  
  
  validates_presence_of :subed_money
  validates_presence_of :user_id,
    :money,
    :rmb,
    :consume_type
  validates_numericality_of :rmb, :greater_than => 0
  validates_numericality_of :subed_money, :greater_than => 0
    
  def before_create
    self.version = 1    
    self.money = user.money - subed_money
  end
  
  def after_create
    user.money -= subed_money
    user.save(false)
  end
    
  # to template
  def to_t
    "取消了:user在:mts_shop_in_taobao花费:rmb购买了:consume_type获赠的:subed_money麦粒"
  end
end